package com.sxhuayuan.parking.service;

import com.sxhuayuan.parking.compenent.Page;
import com.sxhuayuan.parking.compenent.Pageable;
import com.sxhuayuan.parking.entity.Agent;
import com.sxhuayuan.parking.entity.MonthlyProfit;
import com.sxhuayuan.parking.entity.ProfitStatistics;

import java.math.BigDecimal;
import java.time.LocalDate;
import java.util.List;

/**
 * @author 何龙
 * @create 2019-04-25 14:09
 */
public interface ProfitStatisticsService extends BaseService<ProfitStatistics, Long> {

	/**
	 * 根据代理与时间查询某一天的分润统计
	 * 
	 * @param agent
	 * @param date
	 * @return
	 */
	ProfitStatistics findByAgentAndDate(Agent agent, LocalDate date);

	/** 根据代理与条件分页查询 */
	Page<ProfitStatistics> findPage(Pageable pageable, Agent agent);

	/** 根据代理与条件进行分润统计 */
	BigDecimal[] sumByPage(Pageable pageable, Agent agent);

	/** 根据代理与月份 统计代理分润月结算 */
	MonthlyProfit countByAgentAndMonth(Agent agent, LocalDate month);

	/** 根据代理与月份 */
	List<ProfitStatistics> findByAgentAndMonth(Agent agent, LocalDate month);
}
